<template>
  <div class="reading-question grammar-question-list">
    <div class="reading-question-list">
      <div class="scorll-box">
        <div class="answer-number" v-if="paperData.isAnswer">
          共<span> {{ paperData.questionList.length }} </span> 题, 答对<span>
            {{ trueNum }} </span
          >题, 答错 <span> {{ falseNum }} </span> 题， 未答
          <span> {{ noAnswerNum }} </span>题<strong
            v-if="paperData.score || paperData.score == 0"
            >，成绩 <span> {{ paperData.score }} </span>分</strong
          >
        </div>
        <!-- :parentId="paperData.id" -->
       
        <Question
          :questionType="paperData.type"
          v-for="(question, index) in paperData.questionList"
          :key="question.questionId"
          :question="question"
          :isAnswer="paperData.isAnswer"
          :totalIndex="paperData.questionList.length"
          :nowIndex="index + 1"
          :classify="4"
        ></Question>
      </div>
    </div>
  </div>
</template>
<script>
import Question from "@/components/Question";
export default {
  data() {
    return {
      radio: "",
      showParse: false,
    };
  },
  components: {
    Question,
  },
  watch:{
    paperData(nv){
      console.log(nv,"yegyugh");
    }
  },
  computed: {
    trueNum() {
      return this.paperData.questionList.filter((item) => {
        return item.isTrue;
      }).length;
    },
    falseNum() {
      return this.paperData.questionList.filter((item) => {
        return (
          !item.isTrue && item.studentAnswer && item.studentAnswer.length > 0
        );
      }).length;
    },
    noAnswerNum() {
      return this.paperData.questionList.filter((item) => {
        return (
          !item.isTrue &&
          (!item.studentAnswer || item.studentAnswer.length == 0)
        );
      }).length;
    },
    articleTitle() {
      if (this.paperData.type == 5) {
        let title = this.paperData.title;
        let index = 1;
        let pos = title.indexOf("_____");
        while (pos !== -1) {
          title = title.replace(
            "_____",
            `<span class="five-underline">__<span class="red_color">${index}</span>__</span>`
          );
          index++;
          pos = title.indexOf("_____");
        }
        return title;
      } else {
        return this.paperData.title;
      }
    },
  },
  created(){
    console.log(this.paperData,"paperData11111");
  },
  methods: {
    changeFontSize(value) {
      if (value <= 100 && value >= 0) {
        this.articleFontSize = value;
      }
    },
  },
  props: {
    paperData: {
      type: Object,
    },
  },
};
</script>